<template>
  <div class="table-responsive">
    <table class="table table-hover">
      <thead>
      <tr>
        <th>id</th>
        <th>username</th>
        <th>nickname</th>
        <th>mobile</th>
        <th>编辑</th>
      </tr>
      </thead>
      <tbody v-for="user in users">
      <tr>
        <td>{{user.id}}</td>
        <td>{{user.username}}</td>
        <td>{{user.nickname}}</td>
        <td>{{user.mobile}}</td>
        <td>
          <a v-link="{path: '/user/show/' + user.id}">
            详情
          </a>
          <a v-link="'/app/edit/' + user.id">
            设置
          </a>
        </td>
      </tr>
      </tbody>
    </table>
  </div>
</template>
<script>
  export default {
    data () {
      return {
        users: []
      }
    },
    route: {
      data () {
        this.$http.get('/static/users.json')
          .then(function (ret) {
            console.log(ret)
            this.users = ret.data.users
          }, function (err) {
            console.log(err)
          })
      }
    }
  }
</script>
